//
//  ATVPropertyViewController.m
//  FlashController
//
//  Created by Martin Schiøth Dyrby on 7/19/12.
//  Copyright 2012 Molamil. All rights reserved.
//

#import "ATVPropertyViewController.h"



@implementation ATVPropertyViewController


@synthesize path;
@synthesize midiButton;
@synthesize methodButton;

- (id)init
{
    self = [super init];
    if (self) {
        // Initialization code here.
    }
    
    return self;
}


- (void) destroy {

}

- (IBAction)midiMessage:(id)sender {
    NSLog(@"midiMessage");
    NSDictionary *dict;
    if([[midiButton title] isEqualToString:@"Midi"]){
        dict = [[NSDictionary alloc] initWithObjectsAndKeys:@"assignNumPropMidiHandlerForControlType:forControlNum:", @"selector", self, @"receiver", nil];
        
        [[NSNotificationCenter defaultCenter] postNotificationName:@"waitForMidi" object:dict];        
    } else {
        dict = [[NSDictionary alloc] initWithObjectsAndKeys: self, @"receiver", nil];

        [[NSNotificationCenter defaultCenter] postNotificationName:@"deassignMidi" object:dict];    
	[midiButton setTitle: [NSString stringWithFormat: @"Midi"]];
    }
}
- (IBAction)methodMessage:(id)sender {}
- (void) assignNumPropMidiHandlerForControlType: (NSNumber*) controlType forControlNum: (NSNumber*) controlNum {
    NSLog(@"assignNumPropMidiHandlerForControlType %@", self);
	[midiButton setTitle: [NSString stringWithFormat: @"Unmidi", controlType, controlNum]];
    NSString* basepath = [self.path substringToIndex: [self.path rangeOfString:@"." options:NSBackwardsSearch].location];

    NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:@"midiHandler:", @"selector", self, @"receiver", controlType, @"controlType", controlNum, @"controlNum", basepath, @"path", nil];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"assignMidi" object:dict];
}

- (void) midiHandler: (NSNumber*) value {}

- (void) drawFromModel:(NSObject<ATVInstanceProperty>*) model{}

@end
